from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from gironimo.gallery.models import Album, Picture


class PictureInline(admin.TabularInline):
    model = Picture
    extra = 3

class AlbumAdmin(admin.ModelAdmin):
    fieldsets = [
        (None,                    {'fields': ['user',]}),
        (_('Albuminformationen'), {'fields': ['name', 'slug', 'content', 'category',]}),
        (_('HTML'),               {'fields': ['html_title', 'html_description', 'html_keywords',], 'classes': ['collapse']}),
    ]
    inlines = [PictureInline]
    list_display = ('name', 'user', 'created',)
    search_fields = ['name',]
    date_hierarchy = 'created'
    prepopulated_fields = {'slug': ('name',),}
    list_filter = ['created', 'user',]

admin.site.register(Album, AlbumAdmin)
